#include <bits/stdc++.h>

using namespace std;

void decimalToOctal(int n) {
    if (n > 0) {
        decimalToOctal(n / 8); 
        cout << n % 8; 
    }
}

int main() {
    int decimalNumber;
    cin >> decimalNumber;
    
    if (decimalNumber == 0) {
        cout << 0; 
    } else {
        decimalToOctal(decimalNumber);
    }
    
    return 0;
}
